<template>
<div>
  <el-breadcrumb separator="/">
    <el-breadcrumb-item :to="{ path: '/Home' }">首页</el-breadcrumb-item>
    <el-breadcrumb-item>摊位管理</el-breadcrumb-item>
    <el-breadcrumb-item :to="{ path: '/auction' }">竞拍摊位列表</el-breadcrumb-item>
    <el-breadcrumb-item>竞拍摊位明细</el-breadcrumb-item>
  </el-breadcrumb>

  <div>
    <el-form :inline="true"  class="demo-form-inline">

      <el-form-item label="用户名称">
        <el-input v-model="username" placeholder="请输入用户名"></el-input>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click.prevent="search()">查询</el-button>
      </el-form-item>
    </el-form>
  </div>


  <div>
    <el-table :data="stallDetailList" border stripe>
      <el-table-column label="出价时间" prop="bidTime"></el-table-column>
      <el-table-column label="出价金额" prop="bidPrice"></el-table-column>
      <el-table-column label="出价用户" prop="username" ></el-table-column>
      <el-table-column label="保证金">
        <template slot-scope="sc">{{sc.row.cash==0?'为退还':'已退还'}}</template>
      </el-table-column>
    </el-table>
  </div>

  <div>
    <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="pageNum"
        :page-sizes="[3, 6 , 12, 24]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
    ></el-pagination>
  </div>



</div>
</template>

<script>
let stallId = '';
let sid = '';
import Bus from "@/bus.js";
export default {


  name: "AuctionDetail",

  data(){
    return{
      username:'',
      stallId:'',
      uid:'',
      ulist:[],
      status:"",
      pageNum:1,
      pageSize:3,
      total:0,
      stallDetailList:[],
    }
  },

  methods:{

    getAData(val) {
      console.log(val);// III、验证数据
      this.stallId = val;
       sid = val;
    },
    handleCurrentChange(val){
      this.pageNum = val;
      this.initStall();
    },
    handleSizeChange(val){
      this.pageSize = val;
      this.pageNum = 1;
      this.initStall();
    },
    /**
     * 搜索
     */
    search(){
      this.pageNum = 1;
      this.initStallDetail();
    },

    initStallDetail(){
      console.log("这是sid=" + sid)

      let url = "auctionDetail/list";
      this.$axios.get(url, {
        params: {
          now:this.pageNum,
          size:this.pageSize,
          username:this.username,
          stallId:stallId
        }
      }).then(res => {
        console.log("================================")
        console.log(res)
        if (res.data.code == 200) {
          this.stallDetailList = res.data.data.list;
          this.pageSize = res.data.data.pageSize;
          this.pageNum = res.data.data.pageNum;
          this.total = res.data.data.total;

        } else {
          this.$message({
            type: 'error',
            message: res.data.msg,
            duration: 1000
          })
        }
      })
    }


  },
  created(){
   stallId = window.sessionStorage.getItem("auctionStallId");
   console.log("输出通过sessionstorage="+stallId)
     let that = this;
    sid = this.$route.params.stallId;
    this.initStallDetail()
    // Bus.$on("stallId", this.getAData);  // II、接收数据
  }
}
</script>

<style scoped>

</style>